﻿using Esri.ArcGISRuntime;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace WRJClient
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                // Deployed applications must be licensed at the Lite level or greater. 
                // See https://developers.arcgis.com/licensing for further details.
                string licenseKey = "runtimelite,1000,rud4312849854,none,S080TK8EL9J2J9HSX105";
                Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.SetLicense(licenseKey);
                // Initialize the ArcGIS Runtime before any components are created.
                ArcGISRuntimeEnvironment.Initialize();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "ArcGIS Runtime initialization failed.");

                // Exit application
                this.Shutdown();
            }

            Window window = null;
            switch (WRJClient.Properties.Settings.Default.ApplicationType)
            {
                case "OverallState":
                    window = new UI.OverallState.ConsoleWindow();
                    window.Show();
                    break;
                case "SystemMonitor":
                    window = new UI.SystemMonitor.MainWindow();
                    window.Show();
                    break;
                default:
                    MessageBox.Show("Unknown ApplicationType");
                    break;
            }


        }
    }
}
